package model.playable.structure;
import java.util.*;
import model.command.*;
import model.playable.PlayableUser;
import model.playable.unit.Worker;

public class Mine extends ResourceCollector implements HarvestOreable
{
	public Mine(PlayableUser player, Worker[] workers)
	{
		setPlayer(player);
		setIdNumber(-1);
		setUpkeep(1);
		setInfluenceRadius(0);
		setVisibilityRadius(0);
		setCommandQueue(new LinkedList<Command>());
		setCommandsPossibleList(createCommandPossibleList());
		setCurrentPossibleCommandPosition(0);
		setIsInStandBy(false);
		setIsPoweredDown(false);
		setArmor(10);
		setHealth(50);
		setMaxHealth(50);
		setDefensiveDamage(5);
		setWorkers(new ArrayList<Worker>());
		addWorkers(workers);
		setProductionRate(1);
	}
	
	public LinkedList<Command> createCommandPossibleList()
	{
		LinkedList<Command> possibleCommands = new LinkedList<Command>();
		possibleCommands.add(new PowerDown(this));
		possibleCommands.add(new PowerUp(this));
		possibleCommands.add(new Decommission(this));
		possibleCommands.add(new Standby(this));
		possibleCommands.add(new HarvestOre(this));
		return possibleCommands;
	} 
	
	public void incrementHealth(int increment)
	{
		super.incrementHealth(increment);
		if(health <= 0)
			getPlayer().removeMine(this);
	}
	
	public void harvestOre()
	{
		System.out.println("Look I am harvesting a ore resource");
	}
	
	public String toString()
	{
		return "Mine";
	}
}